package net.starwifi.duobao.repository;

import net.starwifi.duobao.entity.GglUser;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.Repository;

import java.util.Date;
import java.util.List;

/**
 * Created by Administrator on 2015/11/24.
 */
public interface GglUserRepository extends Repository<GglUser,Long> {

    @Query(value = "select o from net.starwifi.duobao.entity.GglUser o where o.memberId=?1 and o.status=?2 and o.hdType=?3")
    public List<GglUser> ListUser(Long memberId ,int status,int hdType);

    @Query(value = "select o from net.starwifi.duobao.entity.GglUser o where o.memberId=?1 and o.type=?2 and o.gainDate>=?3")
    public List<GglUser> ListUsere(Long memberId ,int type,Date gainDate);



    @Query(value = "select o from net.starwifi.duobao.entity.GglUser o where o.memberId=?1 and o.gainDate>=?2 and o.type=?3")
    public  GglUser FindMemberid(Long memberId ,Date gainDate,int type);




    @Modifying
    @Query(value = "update net.starwifi.duobao.entity.GglUser o set o.status=?1 where o.gainDate<?2 and o.status=?3 and o.type=?4 and o.hdType=?5")
    public void findAuthMemberId(int status,Date gainDate,int oldstatus,int type,int hdType);
}
